import 'package:oramemo/generated/json/base/json_convert_content.dart';
import 'package:oramemo/entity/msg_entity.dart';

MsgEntity $MsgEntityFromJson(Map<String, dynamic> json) {
  final MsgEntity msgEntity = MsgEntity();
  final int? total = jsonConvert.convert<int>(json['total']);
  if (total != null) {
    msgEntity.total = total;
  }
  final List<MsgRows>? rows = (json['rows'] as List<dynamic>?)?.map(
          (e) => jsonConvert.convert<MsgRows>(e) as MsgRows).toList();
  if (rows != null) {
    msgEntity.rows = rows;
  }
  final int? code = jsonConvert.convert<int>(json['code']);
  if (code != null) {
    msgEntity.code = code;
  }
  final String? msg = jsonConvert.convert<String>(json['msg']);
  if (msg != null) {
    msgEntity.msg = msg;
  }
  return msgEntity;
}

Map<String, dynamic> $MsgEntityToJson(MsgEntity entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['total'] = entity.total;
  data['rows'] = entity.rows?.map((v) => v.toJson()).toList();
  data['code'] = entity.code;
  data['msg'] = entity.msg;
  return data;
}

extension MsgEntityExtension on MsgEntity {
  MsgEntity copyWith({
    int? total,
    List<MsgRows>? rows,
    int? code,
    String? msg,
  }) {
    return MsgEntity()
      ..total = total ?? this.total
      ..rows = rows ?? this.rows
      ..code = code ?? this.code
      ..msg = msg ?? this.msg;
  }
}

MsgRows $MsgRowsFromJson(Map<String, dynamic> json) {
  final MsgRows msgRows = MsgRows();
  final String? createTime = jsonConvert.convert<String>(json['createTime']);
  if (createTime != null) {
    msgRows.createTime = createTime;
  }
  final MsgRowsParams? params = jsonConvert.convert<MsgRowsParams>(
      json['params']);
  if (params != null) {
    msgRows.params = params;
  }
  final int? id = jsonConvert.convert<int>(json['id']);
  if (id != null) {
    msgRows.id = id;
  }
  final int? userId = jsonConvert.convert<int>(json['userId']);
  if (userId != null) {
    msgRows.userId = userId;
  }
  final int? msgType = jsonConvert.convert<int>(json['msgType']);
  if (msgType != null) {
    msgRows.msgType = msgType;
  }
  final String? msgTitle = jsonConvert.convert<String>(json['msgTitle']);
  if (msgTitle != null) {
    msgRows.msgTitle = msgTitle;
  }
  final String? msgContent = jsonConvert.convert<String>(json['msgContent']);
  if (msgContent != null) {
    msgRows.msgContent = msgContent;
  }
  final int? realStatus = jsonConvert.convert<int>(json['realStatus']);
  if (realStatus != null) {
    msgRows.realStatus = realStatus;
  }
  final String? assetsId1 = jsonConvert.convert<String>(json['assetsId1']);
  if (assetsId1 != null) {
    msgRows.assetsId1 = assetsId1;
  }
  return msgRows;
}

Map<String, dynamic> $MsgRowsToJson(MsgRows entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  data['createTime'] = entity.createTime;
  data['params'] = entity.params?.toJson();
  data['id'] = entity.id;
  data['userId'] = entity.userId;
  data['msgType'] = entity.msgType;
  data['msgTitle'] = entity.msgTitle;
  data['msgContent'] = entity.msgContent;
  data['realStatus'] = entity.realStatus;
  data['assetsId1'] = entity.assetsId1;
  return data;
}

extension MsgRowsExtension on MsgRows {
  MsgRows copyWith({
    String? createTime,
    MsgRowsParams? params,
    int? id,
    int? userId,
    int? msgType,
    String? msgTitle,
    String? msgContent,
    int? realStatus,
    String? assetsId1,
  }) {
    return MsgRows()
      ..createTime = createTime ?? this.createTime
      ..params = params ?? this.params
      ..id = id ?? this.id
      ..userId = userId ?? this.userId
      ..msgType = msgType ?? this.msgType
      ..msgTitle = msgTitle ?? this.msgTitle
      ..msgContent = msgContent ?? this.msgContent
      ..realStatus = realStatus ?? this.realStatus
      ..assetsId1 = assetsId1 ?? this.assetsId1;
  }
}

MsgRowsParams $MsgRowsParamsFromJson(Map<String, dynamic> json) {
  final MsgRowsParams msgRowsParams = MsgRowsParams();
  return msgRowsParams;
}

Map<String, dynamic> $MsgRowsParamsToJson(MsgRowsParams entity) {
  final Map<String, dynamic> data = <String, dynamic>{};
  return data;
}

extension MsgRowsParamsExtension on MsgRowsParams {
}